From 4a5ff5cd8ee1bfa707448c7f43285fa358aa83a9 Mon Sep 17 00:00:00 2001 From: "Yuan.Wang" <1536296691@qq.com> Date: Tue, 12 Oct 2021 14:51:43 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-59476=20&&=20REPORT-59475=20=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E6=8E=A7=E4=BB=B6=E6=A0=A1=E9=AA=8C=E8=A7=84=E5=88=99?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=9B=BD=E9=99=85=E5=8C=96=20&&=20=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6=E6=A0=A1=E9=AA=8C=E9=94=99=E8=AF=AF=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=85=AC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../beans/ErrorMsgTextFieldAdapter.java | 11 ++++ .../fr/design/beans/UITextFieldAdapter.java | 46 ++++++++++++++ .../com/fr/design/fun/RegPaneProvider.java | 11 ++++ .../design/fun/TextFieldAdapterProvider.java | 11 ++++ .../fun/impl/AbstractRegPaneProvider.java | 22 +++++++ .../AbstractTextFieldAdapterProvider.java | 22 +++++++ .../fr/design/gui/frpane/RegFieldPane.java | 60 ++++++++++--------- .../ui/designer/FieldEditorDefinePane.java | 53 ++++++++-------- .../designer/TextFieldEditorDefinePane.java | 35 +++++++---- .../widget/ui/FieldEditorDefinePane.java | 42 ++++++------- .../widget/ui/TextFieldEditorDefinePane.java | 20 +++++-- 11 files changed, 242 insertions(+), 91 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/beans/ErrorMsgTextFieldAdapter.java create mode 100644 designer-base/src/main/java/com/fr/design/beans/UITextFieldAdapter.java create mode 100644 designer-base/src/main/java/com/fr/design/fun/RegPaneProvider.java create mode 100644 designer-base/src/main/java/com/fr/design/fun/TextFieldAdapterProvider.java create mode 100644 designer-base/src/main/java/com/fr/design/fun/impl/AbstractRegPaneProvider.java create mode 100644 designer-base/src/main/java/com/fr/design/fun/impl/AbstractTextFieldAdapterProvider.java diff --git a/designer-base/src/main/java/com/fr/design/beans/ErrorMsgTextFieldAdapter.java b/designer-base/src/main/java/com/fr/design/beans/ErrorMsgTextFieldAdapter.java new file mode 100644 index 0000000000..e2444a4eca --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/beans/ErrorMsgTextFieldAdapter.java @@ -0,0 +1,11 @@ +package com.fr.design.beans; + +import javax.swing.JComponent; + +public interface ErrorMsgTextFieldAdapter { + void setText(String str); + + String getText(); + + JComponent getErrorMsgTextField(); +} diff --git a/designer-base/src/main/java/com/fr/design/beans/UITextFieldAdapter.java b/designer-base/src/main/java/com/fr/design/beans/UITextFieldAdapter.java new file mode 100644 index 0000000000..48fa6944fc --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/beans/UITextFieldAdapter.java @@ -0,0 +1,46 @@ +package com.fr.design.beans; + +import com.fr.design.gui.itextfield.UITextField; + +import javax.swing.JComponent; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; + +public class UITextFieldAdapter implements ErrorMsgTextFieldAdapter { + private final UITextField uiTextField = new UITextField(); + + public UITextFieldAdapter(){ + addDocumentListener(); + } + @Override + public void setText(String str) { + uiTextField.setText(str); + } + + @Override + public String getText() { + return uiTextField.getText(); + } + + public void addDocumentListener() { + uiTextField.getDocument().addDocumentListener(new DocumentListener() { + + public void changedUpdate(DocumentEvent e) { + uiTextField.setToolTipText(uiTextField.getText()); + } + + public void insertUpdate(DocumentEvent e) { + uiTextField.setToolTipText(uiTextField.getText()); + } + + public void removeUpdate(DocumentEvent e) { + uiTextField.setToolTipText(uiTextField.getText()); + } + }); + } + + @Override + public JComponent getErrorMsgTextField() { + return uiTextField; + } +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/fun/RegPaneProvider.java b/designer-base/src/main/java/com/fr/design/fun/RegPaneProvider.java new file mode 100644 index 0000000000..26fe62b5e6 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/RegPaneProvider.java @@ -0,0 +1,11 @@ +package com.fr.design.fun; + +import com.fr.design.gui.frpane.RegFieldPane; +import com.fr.stable.fun.mark.Immutable; + +public interface RegPaneProvider extends Immutable { + int CURRENT_LEVEL = 1; + String XML_TAG = "RegPaneProvider"; + + RegFieldPane createRegPane(); +} diff --git a/designer-base/src/main/java/com/fr/design/fun/TextFieldAdapterProvider.java b/designer-base/src/main/java/com/fr/design/fun/TextFieldAdapterProvider.java new file mode 100644 index 0000000000..7ab8c782b4 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/TextFieldAdapterProvider.java @@ -0,0 +1,11 @@ +package com.fr.design.fun; + +import com.fr.design.beans.ErrorMsgTextFieldAdapter; +import com.fr.stable.fun.mark.Immutable; + +public interface TextFieldAdapterProvider extends Immutable { + String XML_TAG = "TextFieldAdapterProvider"; + int CURRENT_LEVEL = 1; + + ErrorMsgTextFieldAdapter createTextFieldAdapter(); +} diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractRegPaneProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractRegPaneProvider.java new file mode 100644 index 0000000000..98185f2a5a --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractRegPaneProvider.java @@ -0,0 +1,22 @@ +package com.fr.design.fun.impl; + +import com.fr.design.fun.RegPaneProvider; +import com.fr.stable.fun.mark.API; + +/** + * @author Joe + * 2021/10/8 15:19 + */ +@API(level = RegPaneProvider.CURRENT_LEVEL) +public abstract class AbstractRegPaneProvider implements RegPaneProvider { + + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + @Override + public int layerIndex() { + return DEFAULT_LAYER_INDEX; + } +} diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractTextFieldAdapterProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractTextFieldAdapterProvider.java new file mode 100644 index 0000000000..bc0836eb40 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractTextFieldAdapterProvider.java @@ -0,0 +1,22 @@ +package com.fr.design.fun.impl; + +import com.fr.design.fun.TextFieldAdapterProvider; +import com.fr.stable.fun.mark.API; + +/** + * @author Joe + * 2021/10/8 15:17 + */ +@API(level = TextFieldAdapterProvider.CURRENT_LEVEL) +public abstract class AbstractTextFieldAdapterProvider implements TextFieldAdapterProvider { + + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + @Override + public int layerIndex() { + return DEFAULT_LAYER_INDEX; + } +} diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/RegFieldPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/RegFieldPane.java index 5d37fb4a96..38e33514bc 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/RegFieldPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/RegFieldPane.java @@ -1,21 +1,25 @@ package com.fr.design.gui.frpane; +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.beans.ErrorMsgTextFieldAdapter; +import com.fr.design.beans.UITextFieldAdapter; import com.fr.design.constants.LayoutConstants; import com.fr.design.designer.IntervalConstants; import com.fr.design.dialog.BasicPane; +import com.fr.design.fun.TextFieldAdapterProvider; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayoutHelper; import com.fr.form.ui.TextEditor; import com.fr.form.ui.reg.NoneReg; import com.fr.form.ui.reg.RegExp; +import com.fr.log.FineLoggerFactory; - -import javax.swing.*; -import javax.swing.event.DocumentEvent; -import javax.swing.event.DocumentListener; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; /** * Created by kerry on 2017/9/4. @@ -23,7 +27,7 @@ import java.awt.*; public class RegFieldPane extends RegPane { protected RegErrorMsgPane regErrorMsgPane; - public RegFieldPane(){ + public RegFieldPane() { this(ALL_REG_TYPE); } @@ -39,8 +43,8 @@ public class RegFieldPane extends RegPane { @Override public void regChangeAction() { - RegExp regExp = (RegExp)getRegComboBox().getSelectedItem(); - if(regExp instanceof NoneReg){ + RegExp regExp = (RegExp) getRegComboBox().getSelectedItem(); + if (regExp instanceof NoneReg) { regErrorMsgPane.setVisible(false); return; } @@ -67,33 +71,35 @@ public class RegFieldPane extends RegPane { } private static class RegErrorMsgPane extends BasicPane { - private UITextField regErrorMsgField; + private ErrorMsgTextFieldAdapter errorMsgTextFieldAdapter; public RegErrorMsgPane() { + initRegErrorMsgField(); + setStyle(); + } + + private void setStyle() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L6, IntervalConstants.INTERVAL_L5, 0, 0)); - initRegErrorMsgField(); UILabel tipLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Error_Tip")); tipLabel.setPreferredSize(new Dimension(60, 20)); - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{tipLabel, regErrorMsgField}}, TableLayoutHelper.FILL_LASTCOLUMN, 10, LayoutConstants.VGAP_MEDIUM); + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{tipLabel, errorMsgTextFieldAdapter.getErrorMsgTextField()}}, TableLayoutHelper.FILL_LASTCOLUMN, 10, LayoutConstants.VGAP_MEDIUM); this.add(panel); } private void initRegErrorMsgField() { - regErrorMsgField = new UITextField(); - regErrorMsgField.getDocument().addDocumentListener(new DocumentListener() { - public void changedUpdate(DocumentEvent e) { - regErrorMsgField.setToolTipText(regErrorMsgField.getText()); - } - - public void insertUpdate(DocumentEvent e) { - regErrorMsgField.setToolTipText(regErrorMsgField.getText()); - } + TextFieldAdapterProvider provider = ExtraDesignClassManager.getInstance().getSingle(TextFieldAdapterProvider.XML_TAG); + if (provider == null) { + errorMsgTextFieldAdapter = new UITextFieldAdapter(); + return; + } + try { + errorMsgTextFieldAdapter = provider.createTextFieldAdapter(); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + errorMsgTextFieldAdapter = new UITextFieldAdapter(); - public void removeUpdate(DocumentEvent e) { - regErrorMsgField.setToolTipText(regErrorMsgField.getText()); - } - }); + } } @Override @@ -102,11 +108,11 @@ public class RegFieldPane extends RegPane { } public void populate(TextEditor textEditor) { - regErrorMsgField.setText(textEditor.getRegErrorMessage()); + errorMsgTextFieldAdapter.setText(textEditor.getRegErrorMessage()); } public void update(TextEditor textEditor) { - textEditor.setRegErrorMessage(regErrorMsgField.getText()); + textEditor.setRegErrorMessage(errorMsgTextFieldAdapter.getText()); } } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java index 45c2cd9686..4ee699e0fe 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java @@ -1,9 +1,17 @@ package com.fr.design.widget.ui.designer; +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.beans.ErrorMsgTextFieldAdapter; +import com.fr.design.beans.UITextFieldAdapter; import com.fr.design.constants.LayoutConstants; import com.fr.design.designer.IntervalConstants; -import com.fr.design.designer.creator.*; +import com.fr.design.designer.creator.XCreator; +import com.fr.design.designer.creator.XCreatorUtils; +import com.fr.design.designer.creator.XLayoutContainer; +import com.fr.design.designer.creator.XWFitLayout; +import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.design.fun.TextFieldAdapterProvider; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; @@ -11,19 +19,19 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.widget.ui.designer.component.FontSizeComboPane; import com.fr.form.ui.FieldEditor; +import com.fr.log.FineLoggerFactory; - -import javax.swing.*; -import javax.swing.event.DocumentEvent; -import javax.swing.event.DocumentListener; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; public abstract class FieldEditorDefinePane extends AbstractDataModify { protected UICheckBox allowBlankCheckBox; // richer:错误信息,是所有控件共有的属性,所以放到这里来 - protected UITextField errorMsgTextField; + protected ErrorMsgTextFieldAdapter errorMsgTextField; protected JPanel validatePane; protected FontSizeComboPane fontSizePane; protected UITextField labelNameTextField; @@ -40,7 +48,6 @@ public abstract class FieldEditorDefinePane extends Abstr allowBlankCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Allow_Null")); allowBlankCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); fontSizePane = new FontSizeComboPane(); - errorMsgTextField = new UITextField(); JPanel contentPane = this.setFirstContentPane(); JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); jPanel.add(contentPane, BorderLayout.CENTER); @@ -76,23 +83,17 @@ public abstract class FieldEditorDefinePane extends Abstr protected void initErrorMsgPane() { // 错误信息 - errorMsgTextField = new UITextField(); -// // richer:主要为了方便查看比较长的错误信息 - errorMsgTextField.getDocument().addDocumentListener(new DocumentListener() { - - public void changedUpdate(DocumentEvent e) { - errorMsgTextField.setToolTipText(errorMsgTextField.getText()); - } - - public void insertUpdate(DocumentEvent e) { - errorMsgTextField.setToolTipText(errorMsgTextField.getText()); - } - - public void removeUpdate(DocumentEvent e) { - errorMsgTextField.setToolTipText(errorMsgTextField.getText()); - } - }); - + TextFieldAdapterProvider provider = ExtraDesignClassManager.getInstance().getSingle(TextFieldAdapterProvider.XML_TAG); + if (provider == null) { + errorMsgTextField = new UITextFieldAdapter(); + return; + } + try { + errorMsgTextField = provider.createTextFieldAdapter(); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + errorMsgTextField = new UITextFieldAdapter(); + } } @@ -111,7 +112,7 @@ public abstract class FieldEditorDefinePane extends Abstr validatePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); final UILabel uiLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Error_Tip")); JPanel borderPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - final JPanel errorTipPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{uiLabel, errorMsgTextField}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); + final JPanel errorTipPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{uiLabel, errorMsgTextField.getErrorMsgTextField()}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); errorTipPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L6, IntervalConstants.INTERVAL_L5, 0, 0)); borderPane.add(errorTipPane, BorderLayout.CENTER); allowBlankCheckBox.addItemListener(new ItemListener() { diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/TextFieldEditorDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/TextFieldEditorDefinePane.java index 2baea973ce..6e6a2ff145 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/TextFieldEditorDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/TextFieldEditorDefinePane.java @@ -1,7 +1,9 @@ package com.fr.design.widget.ui.designer; +import com.fr.design.ExtraDesignClassManager; import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.creator.XCreator; +import com.fr.design.fun.RegPaneProvider; import com.fr.design.gui.frpane.RegFieldPane; import com.fr.design.gui.frpane.RegPane; import com.fr.design.gui.ilable.UILabel; @@ -11,10 +13,12 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; import com.fr.form.ui.TextEditor; - +import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; -import javax.swing.*; -import java.awt.*; + +import javax.swing.JPanel; +import javax.swing.SwingConstants; +import java.awt.Component; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; @@ -65,27 +69,36 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane widgetValueLabel.setVerticalAlignment(SwingConstants.TOP); Component[][] components = new Component[][]{ new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField}, - new Component[]{widgetValueLabel, formWidgetValuePane}, + new Component[]{widgetValueLabel, formWidgetValuePane}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_WaterMark"), SwingConstants.LEFT), waterMarkDictPane}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font_Size"), SwingConstants.LEFT), fontSizePane} }; double[] rowSize = {p, p, p, p, p, p}; - double[] columnSize = {p,f}; - int[][] rowCount = {{1, 1},{1, 3},{1, 1},{1, 1}}; - final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); + double[] columnSize = {p, f}; + int[][] rowCount = {{1, 1}, {1, 3}, {1, 1}, {1, 1}}; + final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); boundsPane.add(panel); return boundsPane; } - public JPanel setValidatePane(){ + public JPanel setValidatePane() { return regPane; } - protected RegFieldPane createRegPane() { - return new RegFieldPane(); + RegPaneProvider provider = ExtraDesignClassManager.getInstance().getSingle(RegPaneProvider.XML_TAG); + if (provider == null) { + return new RegFieldPane(); + } + + try { + return provider.createRegPane(); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + return new RegFieldPane(); + } } @Override @@ -102,7 +115,7 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane @Override protected TextEditor updateSubFieldEditorBean() { - TextEditor ob = (TextEditor)creator.toData(); + TextEditor ob = (TextEditor) creator.toData(); this.regPane.update(ob); ob.setWaterMark(waterMarkDictPane.getText()); formWidgetValuePane.update(ob); diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/FieldEditorDefinePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/FieldEditorDefinePane.java index 9c20dfb652..07faec9227 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/FieldEditorDefinePane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/FieldEditorDefinePane.java @@ -1,19 +1,21 @@ package com.fr.design.widget.ui; +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.beans.ErrorMsgTextFieldAdapter; +import com.fr.design.beans.UITextFieldAdapter; import com.fr.design.constants.LayoutConstants; import com.fr.design.designer.IntervalConstants; import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.design.fun.TextFieldAdapterProvider; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayoutHelper; import com.fr.form.ui.FieldEditor; +import com.fr.log.FineLoggerFactory; import javax.swing.BorderFactory; import javax.swing.JPanel; -import javax.swing.event.DocumentEvent; -import javax.swing.event.DocumentListener; import java.awt.BorderLayout; import java.awt.Component; import java.awt.event.ItemEvent; @@ -22,7 +24,7 @@ import java.awt.event.ItemListener; public abstract class FieldEditorDefinePane extends AbstractDataModify { protected UICheckBox allowBlankCheckBox; // richer:错误信息,是所有控件共有的属性,所以放到这里来 - protected UITextField errorMsgTextField; + protected ErrorMsgTextFieldAdapter errorMsgTextField; protected JPanel validatePane; public FieldEditorDefinePane() { @@ -45,23 +47,17 @@ public abstract class FieldEditorDefinePane extends Abstr protected void initErrorMsgPane() { // 错误信息 - errorMsgTextField = new UITextField(); -// // richer:主要为了方便查看比较长的错误信息 - errorMsgTextField.getDocument().addDocumentListener(new DocumentListener() { - - public void changedUpdate(DocumentEvent e) { - errorMsgTextField.setToolTipText(errorMsgTextField.getText()); - } - - public void insertUpdate(DocumentEvent e) { - errorMsgTextField.setToolTipText(errorMsgTextField.getText()); - } - - public void removeUpdate(DocumentEvent e) { - errorMsgTextField.setToolTipText(errorMsgTextField.getText()); - } - }); - + TextFieldAdapterProvider provider = ExtraDesignClassManager.getInstance().getSingle(TextFieldAdapterProvider.XML_TAG); + if (provider == null) { + errorMsgTextField = new UITextFieldAdapter(); + return; + } + try { + errorMsgTextField = provider.createTextFieldAdapter(); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + errorMsgTextField = new UITextFieldAdapter(); + } } @Override @@ -101,7 +97,7 @@ public abstract class FieldEditorDefinePane extends Abstr allowBlankCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Allow_Null")); allowBlankCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); JPanel borderPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - final JPanel errorTipPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{uiLabel, errorMsgTextField}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); + final JPanel errorTipPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{uiLabel, errorMsgTextField.getErrorMsgTextField()}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); errorTipPane.setBorder(BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L5, 0, 0)); borderPane.add(errorTipPane, BorderLayout.CENTER); allowBlankCheckBox.addItemListener(new ItemListener() { @@ -117,7 +113,7 @@ public abstract class FieldEditorDefinePane extends Abstr new Component[]{allowBlankCheckBox}, new Component[]{borderPane}, }; - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components,TableLayoutHelper.FILL_LASTCOLUMN, 5, 5); + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, 5, 5); panel.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, IntervalConstants.INTERVAL_L6, 0)); validatePane.add(panel, BorderLayout.NORTH); diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/TextFieldEditorDefinePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/TextFieldEditorDefinePane.java index d74d31c507..72e93e28c8 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/TextFieldEditorDefinePane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/TextFieldEditorDefinePane.java @@ -1,14 +1,16 @@ package com.fr.design.widget.ui; +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.fun.RegPaneProvider; import com.fr.design.gui.frpane.RegFieldPane; import com.fr.design.gui.frpane.RegPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.form.ui.TextEditor; - +import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; -import javax.swing.*; -import java.awt.*; +import javax.swing.JPanel; +import java.awt.BorderLayout; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; @@ -60,7 +62,17 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane protected RegFieldPane createRegPane() { - return new RegFieldPane(); + RegPaneProvider provider = ExtraDesignClassManager.getInstance().getSingle(RegPaneProvider.XML_TAG); + if (provider == null) { + return new RegFieldPane(); + } + + try { + return provider.createRegPane(); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + return new RegFieldPane(); + } } @Override